home *** CD-ROM | disk | FTP | other *** search
-
- RED
- A Full Screen Text Editor
-
- Version 7.0
- January 26, 1990
-
-
-
- Written by
-
- Edward K. Ream
- 1617 Monroe Street
- Madison, WI 53711
-
-
-
-
-
- CHAPTER 1 BEFORE USING RED
-
-
- This chapter provides information you should know before using RED. It
- lists the hardware and software required, it reminds you to create a backup
- copy of the distribution disk containing RED, and it lists the files that are
- distributed with the RED system.
-
-
- System Requirements
-
- o An IBM PC/XT/AT computer or compatible with two floppy disks or a hard disk.
-
- o The MS-DOS operating system.
-
- o Either the Microsoft C compiler or the Turbo C compiler. Minor
- modifications in RED's source code will allow RED to compile using other
- C compilers.
-
-
- Backing Up Your Disks
-
- Please back up the distribution disks before using RED. Use the DOS
- COPY command to copy all the files on the distribution disks to backup
- disks. Your backup disks will be used as working disks.
-
- The following files appear on your distribution disks.
-
- File Description
-
- read.me Please read this file first.
- redman.doc This file.
- redtech.doc Technical notes.
- red*.h Header files for RED.
- red*.c Source code files for RED.
- red.exe Executable version of RED.
-
- red.mak Turboc C make file for red.exe.
- red.lnk Turboc C link file for red.exe.
- mred.mmk Microsoft C make files for red.exe.
- mred.ml Microsoft C link files for red.exe.
-
- sherlock.doc Documentation for the Sherlockt debugging system.
- dummysl.h Null definitions for all Sherlock macros.
- reddb.exe Executable version of RED, with Sherlock macros added.
-
- red.mak Turboc C make file for reddb.exe.
- red.lnk Turboc C Link file for reddb.exe.
- mred.mmk Microsoft C make file for reddb.exe.
- mred.ml Microsoft C link file for reddb.exe.
-
-
-
- CHAPTER 2: REFERENCE GUIDE
-
- This chapter tells you how to use REDDit describes RED's commands and
- functions, tells you how to use them and explains what to do about warning
- messages. Each section discusses a particular activity or task that you do
- while creating, changing or saving a document.
-
-
- Starting RED
-
- When RED starts up it does the following:
-
- o Clears the screen and prints a welcoming message. This signon message
- tells you what version of RED you are using and how to print help
- messages. Help messages are simply reminders of what you can do with
- RED.
-
- o Draws the prompt line at the top of the screen. For now, just notice this
- top line; we'll discuss the information on it in a moment.
-
- o Puts the cursor just below the prompt line. The cursor is a distinctive
- character on the screen. (On most video terminals the cursor is shown as a
- box or underline which blinks.)
-
- o Draws the end-of-file marker or the third line of the screen. This line
- looks like:
-
- ----------------------------- End of file. ------------------------------------
-
- Initially, most of the screen is blank because RED's buffer or internal
- memory doesn't contain any information. You can think of the screen as a
- window into part of this buffer. As you make additions, corrections and
- deletions to the buffer, those changes appear automatically on the screen.
- The purpose of the end-of-file marker is to make absolutely clear what the
- buffer does and does not contain.
-
- Let's look again at the prompt line. At the far left, you will see that the
- line says,
-
- line: 1 column: 0
-
- These two fields indicate which lines in the buffer and column on the screen
- that the cursor is on. The next field says,
-
- ..no file..
-
- indicating that the buffer does not contain any information from a file.
-
- Finally, the prompt line tells you what mode RED is in--either edit mode,
- insert mode or overtype modes. In most respects, RED works exactly the
- same regardless of mode; that makes RED simple to use. However, some
- details on how RED works change depending on mode; that makes RED
- powerful. We'll see later that not only can you make RED change modes
- easily, but you can have RED change modes automatically if you so desire.
- This feature allows you to make RED work exactly the way you want.
- We'll discuss modes shortly in complete detail. For the moment, just notice
- what mode RED is now in.
-
- At your option, you have have RED automatically load a text file into RED's
- internal memory (the buffer) when RED initially starts up. For example, if
- you had invoked RED as follows:
-
- red document.txt
-
- then RED would have loaded the file document.txt into the buffer already.
- In that case the screen would not be blank but instead would show you the
- first several lines in the file and the prompt line would be "document.txt"
- instead of "..no file.."
-
-
- Using Function and Control Keys
-
- The term function key refers to a key on your keyboard that does one and
- only one action or function. Just about everything you do with RED
- involves using function keys---they are used to change modes, to insert or
- delete lines and characters, to move the cursor, to split and join lines and to
- start commands. There is also a "repeat" function key that repeats the
- previous function. All function keys can be used in insert, overtype and
- edit modes and all function keys do the same thing, regardless of the current
- mode.
-
- RED needs to be able to distinguish function keys from what you are typing
- into the buffer. Thus, function keys must be assigned to control keys on
- your keyboard. A control key is typed by holding down the key marked
- CTRL on your keyboard while typing another key. For example, you type
- the "control c key" (abbreviated control-c) by typing the letter c while
- holding down the CTRL key.
-
- Throughout this chapter, the name of each function key is followed in
- parenthesis by the control key assigned to it by default. For example, this
- chapter refers to the split function key as split (control-s). So in order to
- press the split function key you must actually press the control-s key on
- your keyboard.
-
-
- Changing Modes
-
- RED has three modes: edit mode, insert mode and overtype mode and all
- function keys act the same regardless of modeDthe only difference between
- the three modes is what happens when you type a non-control character.
- You use three different keys to switch RED between modes--the enter
- iNsert (control-n), the enter overType (control-t) and enter edit (control-e)
- function keys.
-
- Besides these three keys which explicitly change from one mode to another,
- RED can change from one mode to another automatically in three situations:
-
- 1) after every command,
- 2) after inserting new lines and
- 3) whenever the cursor moves up or down one line.
-
- You can change how RED switches modes using three sets of commands:
- def0edit, def0ins, def0over, def1edit, def1ins, def1over, def2edit, def2ins,
- and def2over. (We haven't discussed commands yet, so if you are reading
- this for the first time just realize that how RED switches between modes
- isn't carved in stone.)
-
- I prefer to use a hybrid combination of edit mode and insert modeDI
- configure RED so it acts as if I had issued def0edit, def1ins and def2edit
- commands. For example, to make RED into an "overtype mode editor" just
- issue the def0over, def1over and def2over commands. You'll never see
- insert or edit modes again unless you switch to them explicitly.
-
-
- Inserting Characters with Insert and Overtype Modes
-
- In this section we'll look at insert and overtype modes, leaving edit mode
- for much later. Let's discuss insert mode first, so if RED is not already in
- insert mode press the enter insert (control-n) function key. Notice that the
- prompt line indicates that the mode has changed.
-
- In insert mode, any plain (i.e., non-control) character you type is inserted
- into the buffer without replacing any other information. Characters to the
- right of the cursor "move over" to allow room for the new character. To
- jump the gun a bit, you can make the cursor move left without erasing
- anything by hitting the left (control-l) function key. Try the following:
- insert a few characters, move the cursor left once or twice and insert some
- more characters.
-
- Overtype mode works just like insert mode except that a character directly
- under the cursor is replaced by what you type, instead of moving to the
- right. In other words, in overtype mode you "type over" whatever is
- already on the line. Compare overtype mode to insert mode: enter overtype
- mode, type some characters, move the cursor to the left and type some more
- characters.
-
-
- Inserting New Lines
-
- You can't edit much if you are confined to a single line. You end one line
- and begin another using the insert down (carriage return or control-m)
- function key. Try it. The insert up (line feed or control-j or insert) function
- key is a companion key to the insert down key. The insert up key inserts a
- blank line above the current line.
-
- The insert up (line feed or control-j or insert) and insert down (carriage
- return) function keys may also cause RED to shift automatically to a
- different mode. Which mode RED shifts to after hitting these keys may be
- changed at any time using the def1edit, def1ins and def1over commands.
- For example, the def1edit command causes RED to shift automatically to
- edit mode whenever the insert down or insert up function key is pressed.
-
- Notice that RED will split the line automatically if the cursor reaches the end
- of screen while you are inserting characters. This feature is called line
- wrapping. Try it out. Notice also that line wrapping never happens if there
- are characters to the right of the cursor.
-
-
- Moving the Cursor
-
- In order to change your text, you must position the cursor near the next to
- be changed. This section tells you how to do that.
-
- The right (control-r) and left (control-l) function keys move the cursor right
- or left one column. However, these keys always leave the cursor on the
- same line. For example, nothing happens if you hit the left key when the
- cursor is at the leftmost column of the screen.
-
- The up (control-u) and down (control-d) function keys move the cursor up
- and down one line respectively. The cursor will not move above the first
- line or below the last line of the file.
-
- The up (control-u) and down (control-d) function keys may also cause RED
- to shift into a different mode. Which mode RED will shift to may be
- changed at any time using the def2edit, def2ins and def2over commands.
- For example, the def2ins command causes RED to shift to insert mode
- whenever the up (control-u) or down (control-d) function key is pressed.
-
- The page up (control-q or page up) and page down (control-p or page
- down) function keys move the cursor up or down one page of the file. You
- need not wait for the screen to be completely redrawn before hitting another
- character.
-
- The scroll up (control-w) and scroll down (control-o) function keys scroll
- the cursor up or down. Hitting any key interrupts the scrolling.
-
- The home (home) key positions the cursor at the start of the top line of the
- screen and the end (end) key positions the cursor at the start of the last line
- of the screen.
-
- The word forward (control-f) and word backward (control-b) function keys
- move the cursor forward or backward one word. A word is any sequence
- of characters separated by end-of-line, blank or tabs.
-
-
- Deleting Characters and Lines
-
- A large part of my writing involves deleting characters and lines: two
- words forward and one word (taken) back--two sentences written and one
- erased. RED lets you do this without any fuss.
-
- To delete a single character you must first position the cursor either directly
- over the character or just to its right. The delete left (control-h or
- backspace) function key deletes the character to the left of the cursor.
- Nothing happens if the cursor is up against the left edge of the screen. The
- delete under (del) function key deletes the character directly under the
- cursor.
-
- Use the delete line (control-z) function key to delete the entire line on which
- the cursor rests. The screen is redrawn with the line squeezed out.
-
-
- Undoing Mistakes
-
- Sometimes RED lets us work faster than our thoughts--or maybe our
- fingers have a mind of their own. In any case, there is occasionally a need
- for undoing the "improvements" that have just been visited upon a line.
-
- The undo (control-x) function key restores a line to what it was when the
- cursor last moved to the line. In other words, the undo function undoes
- whatever editing or inserting you have done on the current line. Several
- words of warning: you cannot use the undo (control-x) function key to
- restore a line that has been erased with the erase line (control-z) function
- key. Also, you cannot use the undo (control-x) function key to undo a
- change once you have moved the cursor to another line.
-
-
- Splitting and Joining Lines
-
- Being able to split a line into two pieces or make one line from two is often
- very handy. For instance, to edit a line longer than will fit on the screen,
- you would first split the line, then make your corrections and finally glue
- the line back together again.
-
- The split (control-s) function key splits the current line into two pieces.
- Everything to the left of the cursor stays right where it is. All other
- characters are moved to a new blank line crated below the original line. The
- split (control-s) function key acts just like the insert down (carriage return)
- function key if the cursor is positioned at the right end of the line.
-
- The glue (control-g) function key combines two lines into one. This key
- appends the current line to the line above it and then deletes the lower line.
- The new line is allowed to be longer than the width of the screen.
-
-
- Inserting Control Characters
-
- In rare cases, it is desirable to insert control characters into the buffer. This
- requires a special function key. The verbatim (control-v) function key
- enters the next key pressed into the buffer, no matter what it is. For
- example, to insert a control-s into a buffer, type control-v control-s. After
- you press the verbatim (control-v) function key, but before you press the
- second key, the prompt line says 'verbatim'.
-
-
- Repeating the Previous Function
-
- The repeat (control-a) function key repeats the last function key, edit mode
- function or escape sequence. For example, typing control-p control-a is the
- same as typing control-p twice. As we will see, using the repeat key can
- sometimes save you typing.
-
- The repeat key "amplifies" the effect of several functions as shown in this
- table:
-
- original function amplified function
-
- begin line home
- end line end page
- home page up
- end page page down
-
- For example, typing ESC b ^a ^a is the same as typing ESC b ESC h ^q
- because the first ^a amplifies the begin line function (^b) into the home
- function (ESC h) and the second ^a amplifies the home function into the
- page up function (^q).
-
-
- Using Commands
-
- Up until now, we have been talking about functions, i.e., operations that
- are done by pressing a single function key. However, functions are not
- appropriate in all situations--they might require additional information or
- they might potentially alter too much work to be safe.
-
- Commands are RED's way of performing complex or dangerous operations
- quickly and safely. You start each command with the enter command
- (control-c) function key. Try this key out now. Notice that the cursor
- moves to the prompt line. All commands end with a carriage return, and if
- you type nothing but a carriage return the command is terminated. You can
- also exit from a command by hitting either the enter edit (control-e), the
- enter insert (control-n) or the enter overtype (control-o) function key. OK,
- exit the command in one of the ways just mentioned.
-
- If you make a mistake while entering a command, just hit control-h (also
- known as backspace) to erase single characters. You may use either upper
- or lower case for commands.
-
- At any time, you may change which mode RED will shift to by using the
- def0edit, def0ins and def0over commands. For example, the def0over
- command causes RED to shift to overtype mode after each command.
-
-
- Creating, Saving and Loading Files
-
- After you have finished working on your document you must save it on a
- file. This is a two-step process: you must name the file and you must
- actually save your work to that file.
-
- Use the name command to name your file. Just type "name" (you don't
- type the double quotes) followed by the name you want your file to have,
- followed (as always) by a carriage return. Notice that the prompt line
- changes to reflect the new file name.
-
- Aside: Your file name can haven o more than eight letters or digits,
- followed optionally by a period and no more than three more letters. The
- question mark (?) or star (*) are not allowed in file names. Examples:
-
- legal names illegal names
-
- abc ???.abc
- foo.bar foo.*
- letter.doc letter.doc1
- 12345678.doc 123456789.doc
- xy.z x.y.z
-
- The last step in creating a new file is writing your work to the file. If you
- don't do this your work will be lost, but don't worry, RED reminds you if
- you haven't done so when you try to leave. To save your work, use the
- save command. While the save command is in progress, the message
- "--saving--" appears on the prompt line. The save command doesn't take
- any arguments; your work is saved to the file named on the prompt line. If
- you issue the save command when the prompt line indicates "..no file.."
- RED complains saying, "file not named". Hit any key to clear this message
- and continue.
-
- If RED says "file exists' instead of "--saving--" it means that a file already
- exists on the disk with the name shown on the prompt line. You now have
- two choices: you can pick another name for your file and do the save
- command over again or you can use the resave command to replace what is
- already on that file with your present work. (Watch out: the resave
- command destroys the previous contents of the file.) If you use the resave
- command and the file does not already exist, RED gives you the "file not
- found" message. As with the save command, the resave command never
- takes any arguments.
-
- As mentioned earlier, you can load an already existing file (say memo) at the
- same time you start RED by typing 'red memo'. If RED finds the file on
- the disk, RED loads that file and updates the prompt line to indicate the
- name of the file. This is the file name used by the save and resave
- commands. (of course, you can use the name command at any time to
- change this name.) If the file is not found the prompt line says "file not
- found". As always, hit a carriage return to clear this warning message.
-
- If you did not give a file name when you started RED, or if you got the "file
- not found" message, you can use the load command to load a file into the
- buffer. The load command takes one argument--the name of the file to be
- loaded. As you would expect, the load command changes the file name on
- the prompt line so that the save and resave commands will update the file
- you just loaded. Purely as a convenience, RED treats the red command just
- like the load command. Examples:
-
- load abc.doc
- red memo
- save
- resave
-
- Unlike some other editors, RED's load command does not create a file if it
- does not exist, so you haven't created any unwanted file if you don't get the
- name right. Neither does the load command change the file name on the
- prompt line if the file does not exist. This feature makes the save and resave
- commands safe to use in almost all circumstances. The load command
- replaces whatever is in the buffer by the contents of the file being loaded.
- For your protection, the load command asks "Buffer not saved, proceed?" if
- loading the file might destroy unsaved work. If you answer 'y' the load
- operation begins and whatever is in the buffer is lost. Otherwise, the load
- command terminates and you have an opportunity to save your work.
-
-
- Leaving RED
-
- There are two ways to leave RED. The first is the exit command, which
- takes no arguments. For your protection, RED asks "Buffer not saved,
- proceed?" if you issue this command before you have saved your work.
- Type 'y' to exit anyway or type anything else to cancel the command.
-
- The quit command may or may not be available with your version or RED.
- If it is available, the quit command works like the exit command (it takes no
- arguments), except that RED saves information on your disk so RED can
- reload the file you were working on quickly and automatically. When RED
- is next restarted, it looks for this information to resume editing right were
- you left off.
-
- The quit command is nice to have if you do a lot of work with a single file
- because it saves 99% of the time it takes to load a file with the load
- command. However, the quit command does have some drawbacks.
- First, the saved information (the work file) takes up space on the disk when
- RED is not being used. Second, if the work file is erased, some of your
- work may be lost. Third, if you interrupt RED by hitting your computer's
- reset key, the work file will not have the proper file status line. The next
- time you start RED, RED will complain and you should erase the work file
- by hand.
-
-
- Searching for Patterns
-
- As your file becomes longer and longer, it becomes harder and harder to
- find the parts of it that you want to change. Instead of searching for words
- or phrases yourself, RED can do the searching for you.
-
- In order to do searching, you must specify patterns which tell RED what to
- look for. A pattern is simply any string of characters ended by a carriage
- return. Most letters in patterns just stand for themselves: Examples:
-
- o The pattern 'abc' matches the three letters 'a' 'b' and 'c'
- o The pattern '12-4' matches the four characters '1' '2' '-' and '4'
-
- There are three characters which have special meanings within patterns and
- make patterns more powerful. A question mark in a pattern matches any
- character at all. Examples:
-
- o The pattern '?bc' matches any 'bc' that is not the first character on a line.
- o The pattern 'a?c' matches an 'a' and 'c' with exactly one character between
- them.
- o The pattern '???' matches any three characters on the same line.
-
- A leading caret ('^'), i.e., a caret that appears at the start of a pattern, matches the start of a line. Examples:
-
- o The pattern '^abc' matches any line that starts with 'abc'.
- o The pattern '^??abc' matches any line with 'abc' starting in column 3.
-
- A caret that does not start a pattern loses its special meaning. Examples:
-
- o The pattern '^?^a' matches any line with a '^' in column 2 followed by an 'a'.
- o The pattern '?^' matches any '^' which is not in column 1.
-
- A trailing dollar sign, i.e., a dollar sign that appears at the end of a pattern,
- matches the end of a line. Examples:
-
- o The pattern 'abc$' matches any line that ends with 'abc'.
- o The pattern 'abc??$' matches any line with exactly two characters after 'abc'>
-
- A dollar sign that does not conclude a pattern loses its special meaning.
- Example:
-
- o The pattern '^?$?' matches any line with '$' in column 2 followed by
- some other character.
-
- A leading caret and trailing dollar sign may be used in the same pattern.
-
- Examples:
-
- o The pattern '^abc$' matches any line that contains only 'abc'.
- o The pattern '^?$' matches any line with exactly one character.
-
- The find command puts the cursor at the start of the pattern when the pattern
- is found. You invoke the find command as you would expect: type the
- enter command (control-c) function key followed by find <CR>. The
- prompt line will now ask you for a search mask. This means that you
- should enter a pattern to search for. Type in the pattern and end it with a
- carriage return.
-
- The find command will now search from the place where the cursor is,
- looking for the pattern. If the find command reaches the end of the buffer
- without finding a match the search "wraps around the buffer," i.e., the
- search continues form the start of the buffer to the line where the search
- originally commenced. If the find command eventually matches the pattern,
- RED will place the cursor at the start of the pattern. If no match is found,
- RED will simply put the cursor back where it was before the find command
- was invoked.
-
- The findr command works just like the find command except that it searches
- backwards through the buffer for a pattern.
-
- The search command searches for a pattern just like the find command, but
- the search may be continued after a pattern is found. When a match is
- found, the prompt line will say, "next, exit?". If you hit an 'n', the search
- will continue. The search will end if you hit any other key.
-
- The change command searches for a pattern in a manner similar to the
- search command, but when a match is found a substitution is made. When
- you invoke the change command, you will be asked for a search mask, just
- as with the search command. Next, you will be asked for a change mask.
- Whenever the pattern specified by the search mask is found, the pattern
- specified by the change mask is substituted.
-
- Carets and dollar signs have no special significance in a change mask.
- Question marks in a change mask are replaced by the character that matched
- the corresponding question mark in the search mask.
-
- For example, suppose the search mask is 'a?b?' and the change mask is
- 'A??C'. If the characters that match the search mask are 'a+b-' would be
- replaced by 'A+-C' because the two question marks in the change mask
- would be replaced by '+' and '-' respectively.
-
- The change command does not make all changes in the buffer at once.
- When a match the substitution is made on the screen and the prompt line
- asks,
-
- "yes, no, all, exit?"
-
- The substitution is undone if you reply 'n' or 'e' and the change command
- terminates if you say'e'. If you reply 'y', the change is made and the
- searching continues. If you say 'a', the change is made and searching
- continues. However, when you say 'a', all changes are made without
- further prompting and no further changes are shown on the screen. Only
- the line number field on the prompt line shows that changes are being
- made.
-
- The find and findr commands start searching from the current line, but you
- can change that by invoking these commands with a line number.
-
- Examples:
-
- command search starts at
-
- find current line
- find 1 line 1
- findr 9999 end of buffer
-
- The change and search commands look through the entire buffer for the
- pattern unless you specify a portion of the buffer to search.
-
- Examples:
-
- command what is searched
-
- search every line
- search 1 9999 every line
- change 70 90 lines 70--90
- search 50 lines 50--end
- change 90 9999 lines 90--end
-
-
- Moving Blocks of Lines
-
- One of the most common editing operations is cutting and pasting. RED
- has four commands that make this easy.
-
- The move command moves a block of lines from one place in the buffer to
- another. The move command takes three arguments, the first line to move,
- the last line to move, and the line after which the lines are to be moved.
- Only one line is moved if only two line numbers are given.
-
- Examples:
-
- command line(s) moved where moved
-
- move 1 2 3 1--2 after line 1
- move 1 2 0 1--2 before line 1
- move 2 10 2 after line 10
-
- The copy command works just line the move command except that a copy
- of the lines is moved so that the original lines stay where they were.
-
- Examples:
-
- command line(s) copied where copied
-
- copy 1 2 3 1--3 after line 3
- copy 1 2 0 1--2 before line 1
- copy 1 8 2 after line 8
-
- The extract command copies a block of lines to a file without erasing the
- block from the buffer. Take care with this command: the file is erased if it
- already exists. Another caution: integers are legal file names, so make sure
- you include the file name. Examples:
-
- command file name lines written
-
- extract abc abc whole file
- extract 1 2 1 line 2
- extract abc 1 2 abc lines 1--2
- extract f 1 999 f whole file
-
- The inject command is the companion to the extract command. The inject
- command adds a file to the buffer. It does not replace the buffer as does the
- load command.
-
- Examples:
-
- command where injected
-
- inject abc after current line
- inject abc 0 before line 1
- inject abc 9999 at end of file
- inject abc 50 after line 50
-
- You can use the extract and inject commands to cut and paste between
- different files. Extract a block of lines from the first file into a temporary
- file, load the second file and then inject the lines from the temporary file into
- the second file.
-
-
- Setting Tab Stops
-
- Tab stops effect how tabs are shown on the screen and printed on the
- printer. RED sets tab stops every 8 columns to begin with, but this can be
- changed with the tabs command. After this command the screen is redrawn
- so you can see the results of the new tab setting. Examples:
-
- command width of tabs
-
- tabs 8
- tabs 8 8
- tabs 4 4
-
-
- Enabling and Disabling Line Wrapping
-
- Initially, line wrapping is enabled. Lines are split whenever
-
- a) the cursor is the last character of the line and
- b) the cursor is at the right edge of the screen and
- c) a character is inserted.
-
- The nowrap command disables line wrapping. When line wrapping is
- disabled, no further insertions are allowed in a line when the cursor reaches
- the right margin of the screen. If you want to enable line wrapping again
- after using the nowrap command, use the wrap command.
-
-
- Listing the Buffer
-
- The list command prints the buffer on your printer. Lines are formatted just
- as they are on the screen, but the length of the print line, not the width of the
- screen, determines where long lines are truncated. You can interrupt the
- listing at any time by hitting any control key.
- Examples:
-
- command what is listed
-
- list the current line
- list 15 line 15
- list 1 9999 the entire buffer
- list 400 500 lines 400--500
-
-
- Deleting Multiple Lines
-
- The clear command erases the whole buffer, while the delete command
- deletes one or more lines. The clear command will caution you if erasing
- the buffer might cause work to be lost, but the delete command does not, so
- be careful. Examples:
-
- command what is deleted
-
- clear the whole file
- delete 1 9999 the whole file
- delete the current line
- delete 25 line 25
-
-
- Choosing How RED Switches Modes
-
- As mentioned before, RED will automatically switch from one mode to
- another in three situations:
-
- 1) after every command
- 2) after inserting new lines and
- 3) whenever the cursor moves up or down one line.
-
- You can choose exactly what RED will do in each case. This section tells
- how.
-
- The def0edit, def0ins and def0over commands determine which mode (edit,
- insert or overtype) RED will be in after each command. For example, after
- the def0edit command is given, RED will switch to edit mode after each
- command.
-
- The def1edit, def1ins and def1over commands determine which mode RED
- will be in after the insert up (line feed) or insert down (carriage return)
- function keys are pressed. For example, after the def1ins command is
- given, RED will switch to insert mode whenever a new blank line is
- created.
-
- The def2edit, def2ins and def2over commands determine which mode RED
- will be in after the up (control-u) or down (control-d) function keys are
- pressed. For example, after the def2over command is given, RED will
- switch to overtype mode whenever the up or down function keys are pressed.
-
-
- Edit Mode Functions and Escape Sequences
-
- Edit mode lets you avoid typing so many control keys. In edit mode, typing
- regular (i.e., non-control) keys makes RED act as though function keys
- were pressed. Some people find using normal characters in this way
- confusing, which is why this section has been left until now. Other people,
- myself for instance, think that edit mode is a great convenience.
-
- Escape sequences are an added frill; they are a way of executing edit mode
- functions without switching to edit mode. Escape sequences consist of the
- escape (ESC) function key followed by an edit mode function. For
- example, the 'h' edit mode function homes the cursor to the top left corner
- of the screen. If RED were in insert mode I could home the cursor using
- the ESC h escape sequence without having to switch RED to edit mode
- first. By the way, edit mode commands and escape sequences may be
- typed either in upper case or in lower case.
-
- Here is a list of the edit mode functions. For simplicity's sake the functions
- are listed in alphabetical order. Again, each function may be used outside of
- edit mode by using an escape sequence.
-
- The space bar moves the cursor right one column. Nothing happens if the
- cursor is up against the right edge of the screen. In other words, the space
- bar works exactly the same as the right (control-r) function key.
-
- The '+' key moves the cursor down a half a page. The '-' key moves the
- cursor up a half page.
-
- The b key puts the cursor at the beginning (left hand edge) of the line. This
- key is amplified by the repeat key into the home function. For example,
- typing b ^a in edit mode is the same as typing b p. Similarly, typing ESC b
- ^a in insert mode is the same as typing ESC b ESC p.
-
- The d key causes the cursor to move down rapidly. Type any key to stop
- the scrolling.
-
- The e key moves the cursor to the right end of the line. This key is
- amplified by the repeat key into the end page function. For example, typing
- e ^a in edit mode does the same thing as typing e q. Similarly, typing ESC
- e ^a is the same as typing ESC e ESC z.
-
- The g key moves the cursor to another line. After you type the g the cursor
- will move to the prompt line. The prompt line will show 'goto:' Now type
- a line number followed by a carriage return. By the way, there is a g
- command that works the same way.
-
- The h key homes the cursor to the top left corner of the screen. This key is
- amplified by the repeat key into the page up function. Thus, typing h ^a in
- edit mode is the same as typing h q. Similarly, typing ESC h ^a works the
- same as typing ESC h ESC q.
-
- The k key deletes all characters from the cursor up to but not including the
- word that starts with a "search character". Everything from the cursor to the
- end of the line is deleted if no word starts with the search character. After
- you hit the k the prompt line displays 'kill'. Now type the search character.
- If you wish to cancel the k command before specifying the search character,
- press any control character. The k command will be stopped and no
- deletion will be made. If too much text is deleted, use the undo key and try
- again. Example: Typing k <space> deletes the following word.
-
- The m key moves the cursor to the start of the line in the middle of the
- screen.
-
- The p key moves the cursor down one page. You don't have to wait for the
- screen to be completely redrawn before you hit another key. Thus, hitting
- several p keys is a very fast way to move short distances. The q key is the
- companion to the p key. It moves the cursor up one page.
-
- The s key moves the cursor to the next word that starts with a search
- character. If no word starts with a search character. If no word starts with
- the search character the cursor is moved to the end of the current line. After
- you hit the s key, the prompt line displays 'search'. Now type the search
- character. Example: Typing s <space> moves the cursor right one word.
-
- The u key moves the cursor up rapidly. You stop the scrolling by typing
- any key.
-
- The x key replaces the character under the cursor. After you type the x
- command the prompt line displays 'eXchange'. Now type the new
- character. If you hit a control character no change is made and the x
- command is canceled.
-
- The z key moves the cursor to the start of the last line on the screen. This
- key is amplified by the repeat key into the screen down function. For
- example, typing z ^a in edit mode is the same as typing z p. Similarly,
- typing ESC z ^a is the same as typing ESC z ESC p.
-
-
- What To Do About Error Messages
-
- RED will print a message on the prompt line should anything go amiss.
- You clear the message by hitting any key. Usually the message will be a
- reminder about how to enter a command. For example, if you forget how
- to use the move command, just do the move command anyway. RED will
- say,
-
- usage: move <block> <n>
-
- This may jog your memory enough so you won't have to look up the
- command in this chapter.
-
- The only serious error you might see is:
-
- write error: disk or directory full??
-
- This error usually means that RED could not complete a save or resave
- command because there was not enough room on the disk. This error is not
- too serious; you should be able to recover from this error if you do a save or
- resave to another disk. But you should never remove the disk from which you invoked RED! (That disk contains the work file, which is what you are
- trying to save.)
-
- More rarely you can see this error when you are making insertions into the
- buffer. When this happens, try to save the buffer to a new file on another
- disk. Once again, do not remove the disk from which you invoked RED!
- This may or may not work, depending on whether another disk is available
- Thus, you may lose the work you have done since your last save or resave.
- Obviously this is not a pleasant occurrence. You can avoid this problem by
- making sure that your disk has enough room to hold your work and by
- frequently saving your work.
-